package com.example.perpetualcalendar.ui.fragment.almanac;


import androidx.annotation.NonNull;

import com.example.perpetualcalendar.data.Api;
import com.example.perpetualcalendar.data.network.CommonRetrofit;
import com.example.perpetualcalendar.domain.entity.Almanac;
import com.example.perpetualcalendar.domain.entity.AlmanacRequest;
import com.example.perpetualcalendar.domain.entity.Calendar;
import com.example.perpetualcalendar.domain.entity.CalenderRequest;
import com.example.perpetualcalendar.domain.repository.ApiAlmanac;
import com.example.perpetualcalendar.domain.repository.ApiCalendar;

import java.util.HashMap;

import io.reactivex.Observable;

public class AlmanacRepository extends CommonRetrofit<Api> implements ApiAlmanac {

    public AlmanacRepository() {
    }

    @NonNull
    @Override
    protected Class<Api> getRestClass() {
        return Api.class;
    }


    @NonNull
    @Override
    public Observable<Almanac> almanacApi(String date) {
        AlmanacRequest request = new AlmanacRequest(date);
        HashMap<String, Object> map = new HashMap<>();
        map.put("date",request.getDate());
        map.put("key",request.getKey());
        Observable<Almanac> data = getNetworkService().getAlmanac(map);
        return data;
    }
}
